/**
 * Licensed by the Bunie Developmentgroup.
 */
package Protocol;

import java.util.HashMap;

/**
 * @author Wouter Class is used to request management information or the change of it, useally send
 * from client to server
 */
public class AccountManagementRequestPacket extends BasicPacket {

    private int typeOfManagementPacket;
    private HashMap<String, String> accountInfo = new HashMap();
    private HashMap<String, String> alterAccountToo = new HashMap();

    /**
     * Constructor for the AccountManagementRequestPacket class
     * @param version The current version of this packet
     */
    public AccountManagementRequestPacket(int version) {
        super(version);
        this.type = PacketTypeKeeper.ACCOUNTMANAGEMENTREQUESTPACKET;
    }

    /**
     * Methode to set what type of management packet this is
     * @param type Type of managementpacket 
     */
    public void setTypeOfManagementPacket(int type) {
        this.typeOfManagementPacket = type;
    }
    
    /**
     * Methode to set what type of management packet this is
     * @param type Type of managementpacket 
     */
    public void setTypeOfManagementPacket(String type) {
        this.type = Integer.parseInt(type);
    }

    /**
     * Methode to set what kind of management packet this is
     * @return Type of management packet this is
     */
    public int getTypeOfManagementPacket() {
        return this.typeOfManagementPacket;
    }

    /**
     * Methode to set accountInformation
     * @param windowsLoginId
     * @param name
     * @param password
     * @param usertype found in the typekeeper class
     */
    public void setAccountInformation(
                                String windowsLoginId,
                                String name,
                                String password,
                                String usertype) {
        
        accountInfo.put("username", name);
        accountInfo.put("password", password);
        accountInfo.put("usertype", usertype);
        accountInfo.put("windowsLogingID", windowsLoginId);
    }
    
    /**
     * methode to set account information
     * @param map The HashMap with the account information optional are: 
     * windowsLoginId,name, password and usertype
     */
    public void setAccountInformation(HashMap<String, String> map) {
        this.accountInfo = map;
    }
    
    /**
     * Methode to set the values that are used during an update query
     * @param windowsLoginId
     * @param name
     * @param password
     * @param usertype 
     */
    public void setAlterAccountToo(String windowsLoginId,
                                String name,
                                String password,
                                String usertype) {
        
        alterAccountToo.put("username", name);
        alterAccountToo.put("password", password);
        alterAccountToo.put("usertype", usertype);
        alterAccountToo.put("windowsLogingID", windowsLoginId);
    }

    /**
     * Methode to get the values that are used during an update query
     * @return 
     */
    public HashMap getAccountInformation() {
        return this.accountInfo;
    }

    @Override
    public int getType() {
        return this.type;
    }

    @Override
    public String toString() {
        return super.toString()
        //        + " AccountManagementType " + PacketTypeKeeper.translate(this.getTypeOfManagementPacket());
     +" AccountManagementType " + this.getTypeOfManagementPacket();
                }

    /**
     * Methode to get the values that are used during an update query
     * @return the alterAccountToo
     */
    public HashMap<String, String> getAlterAccountToo() {
        return alterAccountToo;
    }

    /**
     * Methode to set the values that are used during an update query
     * @param alterAccountToo the alterAccountToo to set
     */
    public void setAlterAccountToo(HashMap<String, String> alterAccountToo) {
        this.alterAccountToo = alterAccountToo;
    }
}